package com.jfok.server.hibernate.systemset;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;

import com.jfok.server.common.annotation.FieldDefine;
import com.jfok.server.common.annotation.TableDefine;
import com.jfok.server.hibernate.system._IModuleControlInterface;

@SuppressWarnings("serial")
@Entity
@org.hibernate.annotations.Entity(dynamicUpdate = true)
@TableDefine(group = "系统设置", id = 9001, title = "附加参数设置")
public class _SystemsetAddition implements Serializable , _IModuleControlInterface  {

	@Id
	@Column(insertable = false, updatable = false, nullable = false)
	@FieldDefine(title = "序号", number = 10, hidden = true)
	private Integer tf_systemsetAdditionId;

	@FieldDefine(title = "忘记密码提示", number = 100 )
	private String tf_userforgetPassword;

	@FieldDefine(title = "备份路径", remark = "系统自动备份的数据路径，可以设置多个用;号隔开" , number = 110 )
	@Column(length = 250)
	private String tf_backupfiledirs; // 备份文件的保存路径 ，可以有多个
	
	@FieldDefine(title = "请款金额控制", number = 200)
	@Column(length = 50, nullable = false)
	private String tf_paymentMethod;

	@FieldDefine(number = 210, title = "预付")
	private Integer tf_perBeforehand;

	@FieldDefine(number = 220, title = "主体过半")
	private Integer tf_perWorkhalf;

	@FieldDefine(number = 230, title = "竣工后")
	private Integer tf_perFinish;

	@FieldDefine(number = 240, title = "审计后")
	private Integer tf_perAfterAudit;

	@FieldDefine(number = 250, title = "竣工半年后")
	private Integer tf_perFinishHalfYear;

	@FieldDefine(number = 260, title = "竣工一年后")
	private Integer tf_perFinishOneYear;

	@FieldDefine(number = 270, title = "竣工二年后")
	private Integer tf_perFinishTwoYear;

	@FieldDefine(number = 280, title = "竣工三年后")
	private Integer tf_perFinishThreeYear;

	@FieldDefine(number = 290, title = "竣工四年后")
	private Integer tf_perFinishFourYear;

	
	
	public _SystemsetAddition() {

	}

	public Integer getTf_systemsetAdditionId() {
		return tf_systemsetAdditionId;
	}

	public void setTf_systemsetAdditionId(Integer tf_systemsetAdditionId) {
		this.tf_systemsetAdditionId = tf_systemsetAdditionId;
	}

	public String getTf_paymentMethod() {
		return tf_paymentMethod;
	}

	public void setTf_paymentMethod(String tf_paymentMethod) {
		this.tf_paymentMethod = tf_paymentMethod;
	}

	public Integer getTf_perBeforehand() {
		return tf_perBeforehand;
	}

	public void setTf_perBeforehand(Integer tf_perBeforehand) {
		this.tf_perBeforehand = tf_perBeforehand;
	}

	public Integer getTf_perWorkhalf() {
		return tf_perWorkhalf;
	}

	public void setTf_perWorkhalf(Integer tf_perWorkhalf) {
		this.tf_perWorkhalf = tf_perWorkhalf;
	}

	public Integer getTf_perFinish() {
		return tf_perFinish;
	}

	public void setTf_perFinish(Integer tf_perFinish) {
		this.tf_perFinish = tf_perFinish;
	}

	public Integer getTf_perAfterAudit() {
		return tf_perAfterAudit;
	}

	public void setTf_perAfterAudit(Integer tf_perAfterAudit) {
		this.tf_perAfterAudit = tf_perAfterAudit;
	}

	public Integer getTf_perFinishHalfYear() {
		return tf_perFinishHalfYear;
	}

	public void setTf_perFinishHalfYear(Integer tf_perFinishHalfYear) {
		this.tf_perFinishHalfYear = tf_perFinishHalfYear;
	}

	public Integer getTf_perFinishOneYear() {
		return tf_perFinishOneYear;
	}

	public void setTf_perFinishOneYear(Integer tf_perFinishOneYear) {
		this.tf_perFinishOneYear = tf_perFinishOneYear;
	}

	public Integer getTf_perFinishTwoYear() {
		return tf_perFinishTwoYear;
	}

	public void setTf_perFinishTwoYear(Integer tf_perFinishTwoYear) {
		this.tf_perFinishTwoYear = tf_perFinishTwoYear;
	}

	public Integer getTf_perFinishThreeYear() {
		return tf_perFinishThreeYear;
	}

	public void setTf_perFinishThreeYear(Integer tf_perFinishThreeYear) {
		this.tf_perFinishThreeYear = tf_perFinishThreeYear;
	}

	public Integer getTf_perFinishFourYear() {
		return tf_perFinishFourYear;
	}

	public void setTf_perFinishFourYear(Integer tf_perFinishFourYear) {
		this.tf_perFinishFourYear = tf_perFinishFourYear;
	}

	public String getTf_userforgetPassword() {
		return tf_userforgetPassword;
	}

	public void setTf_userforgetPassword(String tf_userforgetPassword) {
		this.tf_userforgetPassword = tf_userforgetPassword;
	}

	public String getTf_backupfiledirs() {
		return tf_backupfiledirs;
	}

	public void setTf_backupfiledirs(String tf_backupfiledirs) {
		this.tf_backupfiledirs = tf_backupfiledirs;
	}

	// 取得第一个备份路径
	public String firstBackupFileDir() {
		if (tf_backupfiledirs == null || tf_backupfiledirs.length() == 0)
			return "c:\\backup\\";
		else {
			String dir = tf_backupfiledirs.split(";")[0];
			if (!dir.endsWith("\\"))
				dir = dir + "\\";
			return dir;
		}

	}

	// 取得余下的所有的备份路径
	public String[] allBackupFileDirs() {
		if (tf_backupfiledirs == null || tf_backupfiledirs.length() == 0)
			return null;
		else {
			String all[] = tf_backupfiledirs.split(";");
			if (all.length <= 1)
				return null;
			String result[] = new String[all.length - 1];
			for (int i = 0; i < result.length; i++) {
				result[i] = all[i + 1] + (all[i + 1].endsWith("\\") ? "" : "\\");
			}
			return result;
		}
	}
}
